<?xml version="1.0" encoding="windows-1251"?>
<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:ap="http://www.cognitive.ru/museum2"
	exclude-result-prefixes="ap">

	<xsl:output method="xml" encoding="utf-8" />
	<xsl:template match="files">
		<objects xmlns:ct="http://www.cognitive.ru/XML/Common"
			xmlns="http://www.cognitive.ru/museum2">
			<xsl:variable name="objects"
				select="document(doc/@filename)/ap:object" />
			<xsl:for-each select="$objects">
				<object>
					<xsl:apply-templates
						select="ap:materials/ap:material/ap:material | ap:description" />
				</object>
			</xsl:for-each>
		</objects>
	</xsl:template>
	<xsl:template match="*">
		<xsl:copy>
			<xsl:for-each select="@*">
				<xsl:copy />
			</xsl:for-each>
			<xsl:apply-templates />
		</xsl:copy>
	</xsl:template>
</xsl:stylesheet>
